import React, { useEffect, useState } from 'react';
import queryString from 'query-string'

import { getMovieHttp } from '../../../modules';

const Index = () => {
    const [movie, setMovie] = useState([])
    const getDetailHttp = async (id) => {
        let res = await getMovieHttp.getMovieDetailHttp(id)
        setMovie(res.data.res[0])
    }

    useEffect(() => {
        let { id } = queryString.parse(window.location.search)
        getDetailHttp(id)
    }, [])
    
    return (
        <div>
            detail
            <img src={movie.pic} alt="" />
            <p>{movie.title}</p>
        </div>
    );
}

export default Index;
